<? if (!defined("BASEPATH")) exit("No direct script access allowed");

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false );
header("Pragma: no-cache");
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" class="<?=($this->session->userdata("usrId") ? "" : "bg-black")?>">
	<head>
		<title><?=$this->config->item("siteName")?></title>
		<meta charset="UTF-8">
		<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>

		<!-- jquery -->
		<script type="text/javascript" src="<?=MEDIA?>admin_lte/js/jquery.js"></script>

		<!-- bootstrap -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/css/bootstrap.min.css" />
		<script type="text/javascript" src="<?=MEDIA?>admin_lte/js/bootstrap.min.js"></script>

		<!-- font Awesome -->
		<link href="<?=MEDIA?>admin_lte/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

		<!-- DataTables -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/DataTables-1.10.3/media/css/jquery.dataTables.css">
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/DataTables-1.10.3/media/js/jquery.dataTables.js"></script>
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/DataTables-1.10.3/media/css/dataTables.bootstrap.css">
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/DataTables-1.10.3/media/js/dataTables.bootstrap.js"></script>
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/DataTables-1.10.3/extensions/Responsive/js/dataTables.responsive.min.js"></script>
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/DataTables-1.10.3/extensions/Responsive/css/dataTables.responsive.css">
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/DataTables-1.10.3/extensions/Reordering/js/jquery.dataTables.rowReordering.js"></script>

		<!-- Select2 -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/select2-3.5.1/select2.css">
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/select2-3.5.1/select2.min.js"></script>

		<!-- CKE -->
		<script src="<?=MEDIA?>admin_lte/ckeditor/ckeditor.js"></script>
		<script src="<?=MEDIA?>admin_lte/ckeditor/adapters/jquery.js"></script>

		<!-- Datepicker -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/datepicker/css/datepicker.css">
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/datepicker/js/bootstrap-datepicker.js"></script>

		<!-- Image croppper -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/ImageCropper/cropper.css">
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/ImageCropper/cropper.js"></script>

		<!-- Maps -->
		<script src="http://maps.google.com/maps/api/js?sensor=false&amp;language=en&amp;key=AIzaSyChKlShjLaj3A0thExsw65l_nWUXMe9RE8" type="text/javascript"></script>

		<!-- Fancybox -->
		<link rel="stylesheet" href="<?=MEDIA?>admin_lte/fancybox/source/jquery.fancybox.css">
		<script type="text/javascript" src="<?=MEDIA?>admin_lte/fancybox/source/jquery.fancybox.pack.js"></script>

		<!--  Jquery file upload -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/jQuery-File-Upload-9.8.0/css/jquery.fileupload.css">
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/jQuery-File-Upload-9.8.0/js/vendor/jquery.ui.widget.js"></script>
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/jQuery-File-Upload-9.8.0/js/jquery.iframe-transport.js"></script>
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/jQuery-File-Upload-9.8.0/js/jquery.fileupload.js"></script>
		<script type="text/javascript" charset="utf-8" src="<?=MEDIA?>admin_lte/jQuery-File-Upload-9.8.0/js/jquery.fileupload-process.js"></script>

		<!-- Daterange picker -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/daterangepicker/daterangepicker.css">
		<script src="<?=MEDIA?>admin_lte/daterangepicker/moment.min.js"></script>
		<script src="<?=MEDIA?>admin_lte/daterangepicker/daterangepicker.js"></script>

		<!-- File input -->
		<script type="text/javascript" src="<?=MEDIA?>admin_lte/js/bootstrap.file-input.js"></script>

		<!-- Pwstrength -->
		<script type="text/javascript" src="<?=MEDIA?>admin_lte/pwstrength/pwstrength.js"></script>

        <!-- SlimScroll 1.3.0 -->
        <script src="<?=MEDIA?>admin_lte/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script>

        <!-- iCheck -->
        <link href="<?=MEDIA?>admin_lte/iCheck/square/blue.css" rel="stylesheet" type="text/css" />
		<script src="<?=MEDIA?>admin_lte/iCheck/icheck.min.js" type="text/javascript"></script>

		<!-- Theme -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/css/AdminLTE.min.css" />
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/css/skins/skin-blue.min.css" />
		<script type="text/javascript" src="<?=MEDIA?>admin_lte/js/app.min.js"></script>

		<!-- Admin -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>admin_lte/css/admin.css" />
		<script type="text/javascript" src="<?=MEDIA?>admin_lte/js/admin.js"></script>


		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
		  <script src="<?=MEDIA?>admin_lte/js/html5shiv.js"></script>
		  <script src="<?=MEDIA?>admin_lte/js/respond.min.js"></script>
		<![endif]-->

	</head>
	<body class="skin-blue fixed">
		<div class="wrapper">
			<? if($this->session->userdata("usrId")) { ?>

			<header class="main-header">
				<a class="logo" style="font-size:15px;" href="<?=site_url("admin_lte")?>">
					<strong><?=$this->config->item("siteName")?> <?=$this->lang->line("ADMIN")?></strong>
				</a>
				<!-- Header Navbar: style can be found in header.less -->
				<nav role="navigation" class="navbar navbar-static-top">
					<!-- Sidebar toggle button-->
					<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
						<span class="sr-only">Toggle navigation</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</a>
					<div class="navbar-right">
						<ul class="nav navbar-nav">
							<!-- Messages: style can be found in dropdown.less-->
							<? if(Common::isAdmin()) { ?>
							<li class="dropdown messages-menu"><? //ajax loading ?></li>
							<? } ?>
							<!-- Notifications: style can be found in dropdown.less -->

							<li class="dropdown user user-menu">
								<a data-toggle="dropdown" class="dropdown-toggle" href="#">
									<i class="glyphicon glyphicon-user"></i>
									<span><?=$this->session->userdata("usrEmail")?> <i class="caret"></i></span>
								</a>
								<ul class="dropdown-menu">
									<li class="user-body">
										<div class="col-xs-12">
											<a href="javascript:void(0);" id="change_password" style="display: block;"><?=$this->lang->line("CHANGE_PASSWORD")?></a>
											<script>
												$(function() {
													$('#change_password').unbind('click').on('click', function(e) {
														e.preventDefault();
														$this = $(this);
														$.ajax({
															type: "POST",
															cache: false,
															data: { ENTITY: $this.data("entity"), ID: $this.data("fac") },
															url: '<?=site_url("admin_lte/password_change")?>',
															beforeSend: function() {
																$('#studyEditorModal .modal-title').html('<?=$this->lang->line("CHANGE_PASSWORD")?>');
																$('#studyEditorModal .modal-body form').html('<?=$this->db->escape_str($this->lang->line("PLEASE_WAIT,_PROCESSING_IN_PROGRESS"))?>');
																$('#studyEditorModal').modal('toggle');
															},
															success: function (result) {
																$('#studyEditorModal button.btn-success').data('url', '<?=site_url("admin_lte/password_change_insert_update")?>');
																$('#studyEditorModal .modal-body form').html(result);
															},
															error: function (error) {}
														});
													});
												});
											</script>
										</div>
									</li>
									<!-- Menu Footer-->
									<li class="user-footer">
										<div class="pull-left">
											<a class="btn btn-default btn-flat" href="#">Profile</a>
										</div>
										<div class="pull-right">
											<a class="btn btn-default btn-flat" href="<?=site_url("logout")?>">Sign out</a>
										</div>
									</li>
								</ul>
							</li>
						</ul>
					</div>
				</nav>
			</header>

			<aside class="main-sidebar">
				<section class="sidebar">
					<ul class="sidebar-menu">
						<li class="header">
							<?=strtoupper($this->lang->line("DASHBOARD"))?>
						</li>
						<li class="treeview <?=(in_array($this->uri->segment(2), array("schools", "faculties", "majors")) ? "active" : "")?>">
							<a href="#">
								<i class="fa fa-university"></i> <span><?=$this->lang->line("STUDIES")?></span>
								<i class="fa fa-angle-left pull-right"></i>
							</a>
							<ul class="treeview-menu">
								<? if(Common::isAdminJog("INS") and Common::isAdminJog("PAGE_CAT_IMP")) { ?>
									<li <?=($this->uri->segment(2) == "schools" ? "class=\"active\"" : "")?>><a href="<?=site_url("admin_lte/schools")?>" style="margin-left: 10px;"><i class="fa fa-angle-double-right"></i> <?=$this->lang->line("SCHOOLS")?></a></li>
								<? } ?>
								<? if(Common::isAdminJog("INS") and Common::isAdminJog("PAGE_CAT_FAC")) { ?>
									<li <?=($this->uri->segment(2) == "faculties" ? "class=\"active\"" : "")?>><a href="<?=site_url("admin_lte/faculties")?>" style="margin-left: 10px;"><i class="fa fa-angle-double-right"></i> <?=$this->lang->line("FACULTIES")?></a></li>
								<? } ?>
								<? if(Common::isAdminJog("INS") and Common::isAdminJog("PAGE_CAT_MAJ")) { ?>
									<li <?=($this->uri->segment(2) == "majors" ? "class=\"active\"" : "")?>><a href="<?=site_url("admin_lte/majors")?>" style="margin-left: 10px;"><i class="fa fa-angle-double-right"></i> <?=$this->lang->line("MAJORS")?></a></li>
								<? } ?>
							</ul>
						</li>
						<? if(Common::isAdminJog("INS") and Common::isAdminJog("PAGE_CAT_ACC")) { ?>
							<li <?=($this->uri->segment(2) == "accomodations" ? "class=\"active\"" : "")?>>
								<a href="<?=site_url("admin_lte/accomodations")?>">
									<i class="fa fa-home"></i> <span><?=$this->lang->line("ACCOMODATIONS")?></span>
								</a>
							</li>
						<? } ?>
						<? if(Common::isAdminJog("INS") and Common::isAdminJog("PAGE_CAT_SCH")) { ?>
							<li <?=($this->uri->segment(2) == "scholarships" ? "class=\"active\"" : "")?>>
								<a href="<?=site_url("admin_lte/scholarships")?>">
									<i class="fa fa-graduation-cap"></i> <span><?=$this->lang->line("SCHOLARSHIPS")?></span>
								</a>
							</li>
						<? } ?>
						<? if(Common::isAdminJog("INS") and Common::isAdminJog("PAGE_CAT_ART")) { ?>
							<li <?=($this->uri->segment(2) == "articles" ? "class=\"active\"" : "")?>>
								<a href="<?=site_url("admin_lte/articles")?>">
									<i class="fa fa-newspaper-o"></i> <span><?=$this->lang->line("ARTICLES")?></span>
								</a>
							</li>
						<? } ?>
						<li <?=($this->uri->segment(2) == "users" ? "class=\"active\"" : "")?>>
							<a href="<?=site_url("admin_lte/users")?>">
								<i class="fa fa-users"></i> <span><?=$this->lang->line(Common::isAdmin() ? "ADMINISTRATORS" : "USERS")?></span>
							</a>
						</li>
						<li <?=($this->uri->segment(2) == "messages" ? "class=\"active\"" : "")?>>
							<a href="<?=site_url("admin_lte/messages")?>">
								<i class="fa fa-envelope"></i> <span><?=$this->lang->line("MESSAGES")?></span>
							</a>
						</li>
					</ul>
				</section>
			</aside>

			<div class="content-wrapper">

				<section class="content-header">
					<h1><?=$lte_title?></h1>
					<ol class="breadcrumb">
						<li><a href="<?=site_url("admin_lte")?>"><i class="fa fa-dashboard"></i> <?=$this->lang->line("ADMIN")?></a></li>
						<?
						if(isset($breadcrumb)) {
							foreach($breadcrumb as $url => $name) {
								echo	"<li>".anchor($url, $name)."</li>";
							}
						}
						?>
						<li class="active"><?=$lte_title?></li>
					</ol>
				</section>

				<section class="content">
					<?=$content?>
				</section>

			</div>

			<? } else { ?>
				<?=$content?>
			<? } ?>
		</div>

		<? if(Common::isAdmin()) { ?>
		<script>
			function getUnreadMessages() {
				$.ajax({
					type: "POST",
					cache: false,
					url: '<?=site_url("admin_lte/get_unread_messages")?>',
					success: function (result) {
						$('.dropdown.messages-menu').html(result);
					},
					error: function (error) {}
				});
			}
			$(function() {
				getUnreadMessages();
				setInterval(function(){ getUnreadMessages() }, 3000);
			})
		</script>
		<? } ?>

	</body>
</html>